package SingletonPattern;

/**
 * @Author: zhaojie
 * @Date: Created in 10:15 2018/6/26
 * @Description:
 */
public class SingleObject {

    //创建 SingleObject 的一个对象
    private static SingleObject instance=new SingleObject();

    //让构造为私有 就不会实例化
    private SingleObject(){}

    //获取唯一可用的对象
    public static SingleObject getInstance(){
        return instance;
    }

    public void showMessage(){
        System.out.println("Hello World!");
    }
}
